<%
layout("/layouts/platform.html"){
%>
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/losys/factory/order"  data-pjax id="goback"><i class="ti-angle-left"></i> 返回</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="orderAddForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/losys/factory/order/editDo" method="post">
                <div class="row mb10">
                    <div class="col-lg-12">
                    <input type="hidden" name="id" id="id"  value="<%if(!isEmpty(obj)){%>${obj.id}<%}%>">
                    <input type="hidden" name="orderStatus" id="orderStatus"  value="<%if(!isEmpty(orders)){%>${orders.orderStatus}<%}%>">
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">旺旺号</label>

                            <div class="col-sm-8">
                                <input type="text" id="account" class="form-control" name="account" data-parsley-required="true"
                                       placeholder="旺旺号" value="${obj.account}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="unitcode" class="col-sm-2 control-label">收件人</label>

                            <div class="col-sm-8">
                                <input type="text" id="recipient" class="form-control" name="recipient" data-parsley-required="true"
                                       placeholder="收件人" value="${obj.recipient}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="note" class="col-sm-2 control-label">固话</label>

                            <div class="col-sm-8">
                                <input type="text" id="fixedTelephone" class="form-control" name="fixedTelephone" placeholder="固话" readonly="readonly"
                                data-parsley-pattern="(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)" maxlength="14" value="${obj.fixedTelephone}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">收件手机</label>

                            <div class="col-sm-8">
                                <input type="text" id="mobilePhone" name="mobilePhone" class="form-control" data-parsley-required="true"
                                 placeholder="收件手机" data-parsley-pattern="(^0{0,1}1[3-8][0-9]{9}$)" maxlength="11" value="${obj.mobilePhone}" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="telephone" class="col-sm-2 control-label">收件详细地址</label>

                            <div class="col-sm-8">
                                <input type="text" id="address" name="address" class="form-control"  data-parsley-required="true"
                                placeholder="收件详细地址" maxlength="35" value="${obj.address}" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">托寄物型号</label>

                            <div class="col-sm-8">
                                <input type="text" id="mailingModel" name="mailingModel" class="form-control" data-parsley-required="true"
                                 placeholder="托寄物型号" value="${obj.mailingModel}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">尺寸（长宽高）</label>

                            <div class="col-sm-8">
                                <input type="text" id="size" name="size" class="form-control"  data-parsley-required="true"
                                placeholder="尺寸（长宽高）" value="${obj.size}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">托寄物件数</label>

                            <div class="col-sm-8">
                                <input type="text" id="quantity" readonly="readonly" name="quantity" class="form-control" data-parsley-required="true"
                                 placeholder="托寄物件数" data-parsley-pattern="([0-9]*)$" value="${obj.quantity}" maxlength="20">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">颜色</label>

                            <div class="col-sm-8">
                                <input type="text" id="color" name="color" class="form-control"
                                 placeholder="颜色" value="${obj.color}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">运单号</label>

                            <div class="col-sm-8">
                                <input type="text" id="expNum" name="expNum" class="form-control"
                                 placeholder="运单号" value="${orders.expNum}" maxlength="32" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">单号运费金额</label>

                            <div class="col-sm-8">
                                <input type="text" id="freight" name="freight" class="form-control" data-parsley-required="true"
                                 placeholder="单号运费金额" value="${orders.freight}" maxlength="32" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="type" class="col-sm-2 control-label">支付状态</label>
                            <div class="col-sm-8">
                                <select id="payStatus" name="payStatus" class="form-control">
                                    <option value="0" <%if(orders.payStatus==0){%>selected<%}%>>未支付</option>
                                    <option value="1" <%if(orders.payStatus==1){%>selected<%}%>>已支付</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="type" class="col-sm-2 control-label">物流公司</label>
                            <div class="col-sm-8">
                                <input type="text" id="Logistics" name="Logistics" class="form-control"
                                 placeholder=物流公司 value="${obj.Logistics}" maxlength="20" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">备注</label>

                            <div class="col-sm-8">
                                <textarea  id="color" name="remark" class="form-control"
                                 placeholder="备注" maxlength="50" value="${obj.remark}" readonly="readonly"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                                <label for="site_logo" class="col-sm-2 control-label">揽件图片</label>

                                <div class="col-sm-8">
                                    <div id="imgs" style="padding: 5px;">
                                        <img src='${orders.packagePhoto!}' style='width:150px;'>
                                    </div>
                                    <input type="hidden" id="packagePhoto" name="packagePhoto" >
                                </div>
                            </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
               <!--  <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div> -->
            </form>
        </section>

    </div>
</div>
<a class="exit-offscreen"></a>
<script language="JavaScript">
function clearFile() {
    $("#imgs").html("");
    $("#queue").html("");
    $("#img").val("");
    
}
    $(document).ready(function () {
    	$("#packagePhoto").val("${orders.packagePhoto!}");
        $('#orderAddForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code==0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goback").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
        
        
        $('#file_upload').uploadifive({
            'auto': true,
            'multi': false,
            'width': '100%',
            'height': '35',
            'buttonText': '请选择图片',
            'fileType': 'image/jpg,image/jpeg,image/png',
            'fileSizeLimit': 1024,
            'queueSizeLimit': 1,
            'formData': {},
            'queueID': 'queue',
            'uploadScript': '${base}/open/file/upload/image',
            'onUploadComplete': function (file, data) {
                data = JSON.parse(data);
                if (data.code == 0) {
                    Toast.success(data.msg);
                    $("#imgs").html("<img src='" + data.data + "' style='width:150px;'>");
                    $("#packagePhoto").val(data.data);
                } else {
                    clearFile();
                    Toast.error(data.msg);
                }
            },
            'onDrop': function (file, fileDropCount) {
                clearFile();
            },
            'onClearQueue': function (queue) {
                clearFile();
            },
            'onCancel': function () {
                clearFile();
            }
        });
        
        var name="${@shiro.getPrincipalProperty('nickname')}";
        console.log(name);
        if(name!="超级管理员"){
        	$(".col-lg-6").hide();
        }
    });
</script>

<%}%>